What Is 16*2 LCD ?
The LCD ( liquid crystal display) is device to good communicate between user and machine. It display the Software status, Errors, Indicators, Data as per user program by which a good Control method and a good communication occurs between user and electronics system and make a more user Friendly and attractive.
16*2 LCD Display |
Features:
Lcd displays are widely used because of its low current consumption as compared to seven segment displays. And another, it is more attractive to the seven segment display (SSD).16*2 LCD is mostly used to interfacing of 8051 Microcontroller.
How 16*2 LCD Interface With 8051 Microcontroller ?
Pin Description and Details of 16*2 LCD |
Applications:
- Digital Voltmeter / Ammeter.
- Digital Speedometer / odometer.
- Home Automation System.
- Display for Music Player.
- Status Indicator Display.
- Digital Clock.
Command to Operate 16*2 LCD Display Module:
Hex Code Work Function
38h - Initialize 2 line display of 5*7 Matrix.
01h - Clear Display
02h - Cursor Return to Home
04h - Decrement Cursor ( in Left Side )
05h - Shift Display Right
06h - Increment Cursor ( in Right Side )
07h - Shift Display Left Side
08h - Display Off & Cursor Off
0ah - Display Off & Cursor On
0ch - Display On & Cursor Off
0eh - Display On & Cursor On
0fh - Display On & Cursor On and Blinking
10h - Move Cursor One Position Left Side
14h - Move to Cursor One Position Right Side
18h - Shift Entire Display Left Side
1ch - Shift Entire Display Right Side
80h - Move Cursor to Beginning of 1st Line
c0h Move Cursor to Beginning of 2nd Line
How 16*2 LCD Display Work? How We can Display Message on 16*2 LCD? How to Initialization of 16*2 LCD? LCD Initialization........
- Give the Supply and Wait for a Second to Stabilize the Display.
- Give the Instruction 38h for Initialize 2 Line display of 5*7 Matrix LCD.
- Wait for a few millisecond (approx 5ms) to Complete Operation and LCD take Action as per given Command.
- Give 0fh Command to Display ON & Cursor ON and Blinking.
- Wait for some time (approx 5 ms).
- Give command 01h to clear the Display of LCD.
- Wait for some time (approx 5ms).
- Give command 06h for making Increment Cursor mode of LCD. By this, cursor should increase after every Character is Written to display automatically.
- Wait for some time (approx 5 ms).
- Give the command 80h for Cursor take position at 1st Line 1st Character.
Circuit Diagram:
Circuit diagram of LCD interfacing with 8051 Microcontroller |
Assembly Language Program to Display "Welcome to Here" in 16*2 LCD Display:
org 0000h
port_ini:
mov p1,#00h
setb p3.4
setb p3.5
setb p3.6
acall delay_1s
Lcd_ini:
mov a,#38h
acall command
mov a,#06h
acall command
mov a,#0ch
acall command
mov a,#01h
acall command
mov a,#80h
acall command
acall delay_1s
Display:
mov a,#'W'
acall write
mov a,#'e'
acall write
mov a,#'l'
acall write
mov a,#'c'
acall write
mov a,#'o'
acall write
mov a,#'m'
acall write
mov a,#'e'
acall write
mov a,#14h
acall command
mov a,#'t'
acall write
mov a,#'o'
acall write
mov a,#14h
acall command
mov a,#'H'
acall write
mov a,#'e'
acall write
mov a,#'r'
acall write
mov a,#'e'
acall write
here:
sjmp here
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
command:
mov p1,a
clr p3.4
clr p3.5
setb p3.6
acall delay
clr p3.6
acall delay
acall delay
ret
write:
lcall ready
mov p1,a
setb p3.4
clr p3.5
setb p3.6
acall delay
clr p3.6
acall delay
acall delay
ret
ready:
setb p1.7
clr p3.4
setb p3.5
wait:
clr p3.6
acall delay
setb p3.6
jb p1.7,wait
ret
delay:
mov r0,#1ch
rep:
djnz r0,rep
ret
delay_1s:
mov r3,#08h
df1s:
mov r2,#0ffh
d1s:
mov r1,#0ffh
de1s:
djnz r1,de1s
djnz r2,d1s
djnz r3,df1s
ret
end